from option import Option
import signals
import gtk
import random

SCRAMBLING_ALGS={'3x3x3':1,'2x2x2':2}

def scramble(scrlen,moves=('R','L','U','D','F','B')):
	ret=[]
	last=-1
	for x in range(0,scrlen):
		move=last
		while move==last:
			move=int(random.random()*len(moves))

		q=int(random.random()*3)
		if q==0:
			q=''
		elif q==1:
			q='2'
		else:
			q='\''
		
		ret.append((move,q))
		last=move


	ret=map(lambda x:moves[x[0]]+x[1],ret)
	return str.join(" ",ret)

	
def generate(sig,usr,prog):
	scr=scramble(20)
	Option().windowMain.header.set_text(scr)


def init():
	signals.connect('backend.prepare',generate)

def info():
	return {'name':'mod_scrambler',
			'author':'Michal Hordecki',
			'description':'Simple, alpha-stage cube scrambler.',
			}

def teardown():
	pass

